package com.loong.web.gp4j.service.user;

import com.loong.tool.lang.Strings;
import com.loong.web.gp4j.bean.param.user.UserDetailParam;
import com.loong.web.gp4j.bean.schema.user.UserDetailSchema;

/**
 * 用户详情封装器
 *
 * @author 张成轩
 */
public class UserDetailAdapter {

	/**
	 * @param schema
	 * @param param
	 */
	public static void convert(UserDetailSchema schema, UserDetailParam param) {

		if (schema == null)
			return;
		param.setName(schema.getName());
		param.setSex(schema.getSex());
		param.setBirthday(schema.getBirthday());
	}

	/**
	 * @param param
	 * @param schema
	 */
	public static void convert(UserDetailParam param, UserDetailSchema schema) {

		schema.setName(Strings.isNull(param.getName()) ? null : param.getName());
		schema.setSex(param.getSex());
		schema.setBirthday(Strings.isNull(param.getBirthday()) ? null : param.getBirthday());
	}
}
